package cn.shenlong.portal.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import cn.shenlong.mybatis.BaseMapper;
import cn.shenlong.portal.domain.MemberCard;

public interface MemberCardMapper extends BaseMapper<MemberCard> {

	/**
	 * 根据会员卡号，查询会员卡
	 * @param memberCardCode 会员卡号
	 * @return
	 */
	@Select("select t.* from T_DC_MEMBER_CARD t where t.MEMBER_CARD_CODE=#{memberCardCode} and t.dataflg=1")
	@ResultMap("BaseResultMap")
	public MemberCard findMemberCardByCode(@Param("memberCardCode") String memberCardCode);
	
	/**
	 * 根据会员ID，查询会员卡
	 * @param memberCardCode 会员卡号
	 * @return
	 */
	@Select("select t.* from T_DC_MEMBER_CARD t where t.MEMBER_ID=#{memberId} and t.dataflg=1")
	@ResultMap("BaseResultMap")
	public MemberCard findMemberCardByMemberId(@Param("memberId") Long memberId);
	
	public int unbind(Long memberCardId);
}